/**
 * Created by ebalmes Oct 5, 2009 8:46:30 AM
 * 
 */
package model.interfaces;

import java.util.Date;
import java.util.List;

import exceptions.DataException;

import listeners.IDataModelListener;
import model.types.MedEx;
import model.types.Patient;

public interface IDataModel
{
  public void addPatient(Patient patient) throws DataException;
  
  public void addMedEx(MedEx medEx, Patient patient);
  
  public void removePatient(int tajNumber) throws DataException;
  
  public void removeMedEx(int medExId, Patient patient) throws DataException;
  
  public void addPatients(List<Patient> patients);
  
  public void updatePatient(int tajNumber, Patient updatedPatient) throws DataException;
  
  public void updateMedEx(int medExId, MedEx updatedMedEx) throws DataException;
  
  public Patient getPatientByTajNumber(int tajNumber) throws DataException;
  
  public List<Patient> getPatients(String searchString);
  
  public List<MedEx> getMedex4PatientBetweenDates(int tajNumber, Date startDate, Date endDate) throws DataException;
  
  public void fireDataModelCleaned();
  
  public void fireDataModelUpdated();
  
  public void addDataModelListener(IDataModelListener l);
  
  public void removeDataModelListener(IDataModelListener l);
  
  /**
   * Cleares the datamodel. Erases all data.
   */
  public void clearModel();
  
  /**
   * Sets the selected patient tajNumber.
   * All the listeners will be notified that the selected patient have been changed.
   * @param tajNumber
   * @throws DataException 
   */
  public void setSelectedPatient(int tajNumber) throws DataException;
  
  /**
   * Returns the selected patient.
   * @return the selected patient.
   * @throws DataException 
   */
  public Patient getSelectedPatient() throws DataException;
}
